package com.kehao.accountbook.pojo;

import java.sql.Time;

public class SimpleTime {
    private int hour;
    private int min;
    private int second;

    public SimpleTime(int hour, int min, int second) {
        this.hour = hour;
        this.min = min;
        this.second = second;
    }

    @Override
    public String toString() {
        String strSecond;
        String strHour;
        String strMin;
        if(hour<10){
            strHour = "0"+hour;
        }else {
            strHour = ""+hour;
        }
        if(min<10){
            strMin = "0"+min;
        }else {
            strMin = ""+min;
        }
        if(second<10){
            strSecond = "0"+second;
        }else {
            strSecond = ""+second;
        }
        return strHour+":"+strMin+":"+strSecond;
    }

    public SimpleTime(Time time){
        String str = time.toString();
        String[] strArr = str.split(":");
        hour = Integer.parseInt(strArr[0]);
        min = Integer.parseInt(strArr[1]);
        second = Integer.parseInt(strArr[2]);
    }

    public SimpleTime() {
        Time time = new Time(System.currentTimeMillis());
        String str = time.toString();
        String[] strArr = str.split(":");
        hour = Integer.parseInt(strArr[0]);
        min = Integer.parseInt(strArr[1]);
        second = Integer.parseInt(strArr[2]);
    }

    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public int getMin() {
        return min;
    }

    public void setMin(int min) {
        this.min = min;
    }

    public int getSecond() {
        return second;
    }

    public void setSecond(int second) {
        this.second = second;
    }
}
